const {ipcMain} = require('electron')
const {send: sendMainWindow} = require('./windows/main')
const {create: createControlWindow, send: sendControlWindow} = require('./windows/control')
module.exports = function () {
    ipcMain.handle('login', async () => {
        let code = Math.floor(Math.random() * (999999 - 100000)) + 100000;
        return code;
    })
    ipcMain.on('control', async (e, remoteCode) => {
        //  这里跟服务端交互，但是mock返回
        sendMainWindow('control-state-change', remoteCode, 1)
        createControlWindow()
    })
}